/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.sorbonne.soa.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Nairo
 */
@Entity
@Table(name = "MANUFACTURERINFO")
@NamedQueries({@NamedQuery(name = "Manufacturerinfo.findAll", query = "SELECT m FROM Manufacturerinfo m"), @NamedQuery(name = "Manufacturerinfo.findByManufacturerid", query = "SELECT m FROM Manufacturerinfo m WHERE m.manufacturerid = :manufacturerid"), @NamedQuery(name = "Manufacturerinfo.findByCompanyname", query = "SELECT m FROM Manufacturerinfo m WHERE m.companyname = :companyname")})
public class Manufacturerinfo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "MANUFACTURERID")
    private String manufacturerid;
    @Column(name = "COMPANYNAME")
    private String companyname;
    @OneToMany(mappedBy = "manufacturer")
    private Collection<Customerorder> customerorderCollection;
    @JoinColumn(name = "PRODUCT3", referencedColumnName = "PRODUCTTYPEID")
    @ManyToOne(optional = false)
    private Productinfo product3;
    @JoinColumn(name = "PRODUCT2", referencedColumnName = "PRODUCTTYPEID")
    @ManyToOne(optional = false)
    private Productinfo product2;
    @JoinColumn(name = "PRODUCT1", referencedColumnName = "PRODUCTTYPEID")
    @ManyToOne(optional = false)
    private Productinfo product1;

    public Manufacturerinfo() {
    }

    public Manufacturerinfo(String manufacturerid) {
        this.manufacturerid = manufacturerid;
    }

    public String getManufacturerid() {
        return manufacturerid;
    }

    public void setManufacturerid(String manufacturerid) {
        this.manufacturerid = manufacturerid;
    }

    public String getCompanyname() {
        return companyname;
    }

    public void setCompanyname(String companyname) {
        this.companyname = companyname;
    }

    public Collection<Customerorder> getCustomerorderCollection() {
        return customerorderCollection;
    }

    public void setCustomerorderCollection(Collection<Customerorder> customerorderCollection) {
        this.customerorderCollection = customerorderCollection;
    }

    public Productinfo getProduct3() {
        return product3;
    }

    public void setProduct3(Productinfo product3) {
        this.product3 = product3;
    }

    public Productinfo getProduct2() {
        return product2;
    }

    public void setProduct2(Productinfo product2) {
        this.product2 = product2;
    }

    public Productinfo getProduct1() {
        return product1;
    }

    public void setProduct1(Productinfo product1) {
        this.product1 = product1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (manufacturerid != null ? manufacturerid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Manufacturerinfo)) {
            return false;
        }
        Manufacturerinfo other = (Manufacturerinfo) object;
        if ((this.manufacturerid == null && other.manufacturerid != null) || (this.manufacturerid != null && !this.manufacturerid.equals(other.manufacturerid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.sorbonne.soa.entity.Manufacturerinfo[manufacturerid=" + manufacturerid + "]";
    }

}
